<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <meta name="wap-font-scale" content="no">
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title><?=$title?></title>
    <link rel="stylesheet" href="/mobile/css/reset.css">
    <link rel="stylesheet" href="/mobile/css/mui.min.css">
    <script src="/mobile/js/flexible_css.debug.js"></script>
    <script src="/mobile/js/flexible.debug.js"></script>
    <link rel="stylesheet" href="/mobile/css/main_train.css">

</head>
<body>
<div id="back-btn-wrap">
    <a class="back-btn" href="javascript:history.go(-1)"></a>试卷预览
    <a class="add-btn" href="javascript:void(0);">添加题目</a>


</div>
<div v-cloak class="content-main preview-wrap">
    <div class="title">
        题目
    </div>
</div>
<script src="/mobile/js/jquery.min.js"></script>
<script src="/mobile/js/common.js"></script>
<script src="/mobile/js/mui.min.js"></script>
<script src="/mobile/js/jrrpc.js"></script>

<script>
    function exitEdit(e){
        e.preventDefault();
        //回到app
        if(iService.getUserAgent().isiOS){
            editFinishPaper(0);
        }else {
            h5button.editFinishPaper(0);
        }
    }
</script>
<script>
    $(function(){
        mui.init();
        var appParam = iService.getAppParam();
        $('.add-btn').on('click',function(){
            window.location.href = 'edit?token='+appParam.token+'&llid='+appParam.llid+'&channelType=1';
        });

        $(".back-btn").on('click',exitEdit);

        var param = {
            postData:'Question/preview',
            data: {
            }
        };
        $.extend(param.data,appParam);
        $.JsonRpc(param,function(result){
            console.log(result);
            if(!result.data.length){
                var html_tips = '<p class="null-wrap">当前没有添加的题目</p>';
                $(html_tips).appendTo('.content-main');
                return false;
            }
            var str_html = '';
            var question_arr = result.data;
            $.each(question_arr,function(k){
                var quee_type = '单选题';
                if(question_arr[k].type==2){
                    quee_type = '多选题';
                }

                var class_a_c = '',class_b_c = '',class_c_c = '',class_d_c = '';
                var option_c = question_arr[k].correct.split(',');
                if(option_c.indexOf('1')>=0){
                    class_a_c = 'active';
                }
                if(option_c.indexOf('2')>=0){
                    class_b_c = 'active';
                }
                if(option_c.indexOf('3')>=0){
                    class_c_c = 'active';
                }
                if(option_c.indexOf('4')>=0){
                    class_d_c = 'active';
                }


                str_html +=
                        '<section class="questions-wrap choose-wrap">'+
                        '<div class="questions-item clearfix" data-type="'+question_arr[k].type+'">'+
                        '<div><span class="num-now-wrap fl">'+(k+1)+'、</span></div><p class="question">('+quee_type+')'+question_arr[k].topic+'？<a href="reedit?qid='+question_arr[k].qid+'&token='+appParam.token+'&llid='+appParam.llid+'">编辑题目</a></p>'+
                        '</div>'+
                        '<div class="option-item clearfix '+class_a_c+'" style="">'+
                        '<span class="'+class_a_c+'">A</span><p class="option-text">'+question_arr[k].option_a+'</p>'+
                        '</div>'+
                        '<div class="option-item clearfix '+class_b_c+'">'+
                        '<span class="'+class_b_c+'">B</span><p class="option-text">'+question_arr[k].option_b+'</p>'+
                        '</div>'+
                        '<div class="option-item clearfix '+class_c_c+'">'+
                        '<span class="'+class_c_c+'">C</span><p class="option-text">'+question_arr[k].option_c+'</p>'+
                        '</div>'+
                        '<div class="option-item clearfix '+class_d_c+'">'+
                        '<span class="'+class_d_c+'">D</span><p class="option-text">'+question_arr[k].option_d+'</p>'+
                        '</div>'+
                        '</section>'

            });
            $(str_html).appendTo('.content-main');

//            $('.content-main').html(str_html);
            $.each($(".option-item span"),function(){
                var height_cur = $(this).parent('.option-item').height();
                $(this).height(height_cur);
                $(this).css('line-height',height_cur+'px');
            });
        });
        $.get('https://www.wzxaini9.cn/api/flow/index/id/11', function (data) {
            console.log($.parseJSON(data));
        })
    });
</script>
</body>
</html>












